package edu.iwyf.pms.controller;

import edu.iwyf.pms.entity.SysUser;
import edu.iwyf.pms.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author 王永飞
 * 2021/12/21 15:50
 */
@RestController
@RequestMapping("/user")
public class SysUserController {

    @Autowired
    private SysUserService service;

    @RequestMapping(value = "add",method = RequestMethod.POST)
    public boolean addUser(SysUser sysUser){
        return service.addUser(sysUser);
    }

    @RequestMapping(value = "login",method = RequestMethod.POST)
    public Map<String,Object> login(String username,String password){
        return service.searchByNameAndPass(username,password);
    }
}
